﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Main.Master" Inherits="System.Web.Mvc.ViewPage<Ecommerce.Admin.Models.ArticleCategoryViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Danh sách danh mục
</asp:Content>
<%@ Import Namespace="Ecommerce.Lib.Paging" %>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <form action="" method="POST" id="adminForm" name="adminForm">
    <input type="hidden" name="multi_del" id="multi_del" value="" />
    <div style="width:100%; margin:0 auto;">

        <style type="text/css">
            .Breadcrumb { padding-top: 6px; padding-bottom: 6px; }
            .Breadcrumb ul, .Breadcrumb li { list-style: none outside none; margin: 0; padding: 0; }
            .Block ul li { margin-top: 5px; }
            .Breadcrumb li { display: inline; padding-left: 6px; }
            .Breadcrumb li a{ background: url("/Content/Images/breadcrumbsep.gif") no-repeat scroll right center transparent; color: #005FA3; font-weight: normal; padding-right: 10px; text-decoration: none; }
            .Breadcrumb li a:hover{ text-decoration: underline; }
        </style>

        <div id="Breadcrumb" class="Block Breadcrumb ui-widget-content ui-corner-top ui-corner-bottom">
            <ul>
                <li><a href="#">Trang chủ</a></li><li>Danh mục tin tức</li>
            </ul>
        </div>
        <div style="clear: both;"></div>

        <div id="ctl00_cph_Main_Content" style="width:100%; height:100%;"><div id="ctl00_cph_Main_ctl00_ContentPane" style="vertical-align:top;">
                <div id="ctl00_cph_Main_ctl00_ctl00_MenuTab_divSubMenu" class="ui-widget-content ui-corner-top ui-corner-bottom" style="margin: 5px 0px 5px 0px; height: 25px;">
                    <div style="padding: 5px; float: right;">
                        <% Html.RenderPartial("Head"); %>
                    </div>
                </div>
                <div class="ui-widget-content ui-corner-top ui-corner-bottom">
                    <div id="toolbox">
                        <div class="header" style="float:left;">
                            <img id="ctl00_cph_Main_ctl00_ctl00_toolbox_imgHeader" src="/Content/Images/header/icon-48-generic.png" style="border-width: 0px;">
                            <span id="ctl00_cph_Main_ctl00_ctl00_toolbox_lblTitle">Danh mục tin tức</span>
                        </div>
                        <div style="float:right;">

                            <table class="toolbar">
                                <tbody>
                                <tr>                                     
                                        <td align="center">
                                            <a id="ctl00_cph_Main_ctl00_ctl00_toolbox_rptAction_ctl02_lbtAction" title="Thêm mới" class="toolbar" href="/ArticleCategory/Create"><span id="ctl00_cph_Main_ctl00_ctl00_toolbox_rptAction_ctl02_lblAction" title="Thêm mới" class="Icon-32-Add"></span>Thêm mới</a>
                                        </td>                                       
                                    </tr>
                                </tbody>
                                </table>

                        </div>
                    </div>
                </div>


                <div class="ui-widget-content ui-corner-top ui-corner-bottom" style="padding: 2px; margin: 5px 0px 5px 0px;">
                    <div>
                       
                    </div>
                    <div>
                        <div>
                            <table class="adminlist" rules="all" id="ctl00_cph_Main_ctl00_ctl00_ctl00_grvProducts" style="width: 100%; border-collapse: collapse;" border="1" cellspacing="0">
                                <tbody>
                                    <tr>
                                        <th scope="col">#</th>
                                        <th scope="col">Ảnh đại diện</th>
                                        <th scope="col">Nhóm danh mục</th>                                        
                                        <th scope="col">Trạng thái</th>
                                        <th scope="col">Thứ tự</th>                                                                          
                                        <th scope="col">Thao tác</th>
                                    </tr>
                                    <% int stt = 0; %>
                                    <% foreach (var item in Model.TreeCategories)
                                       { %>
                                    <tr class="row0">
                                        <td class="Id" style="width: 20px;" align="center">
                                            <%= stt++%>                                            
                                        </td>
                                        <% string imagepath = Model.ImagePath + item.ImagePath; %>
                                        <td style="width:50px;" align="center"><img src="<%=imagepath %>" width="20px;"</td>
                                        <td style="width: 300px;" align="left">
                                            <%= item.TreeNode %>
                                        </td>
                                        <td style="width: 20px;" align="center">
                                            <div class="imgs_<%=item.ID %>"><%= item.Status == true ? "<img src='/Content/Images/icon_active.png' style='cursor:pointer' title='Hiển thị' class='changeStatus' id='" + item.ID + "' />" : "<img style='cursor:pointer' title='Không hiển thị' src='/Content/Images/icon_inactive.png' class='changeStatus' id='" + item.ID + "' />"%></div>
                                        </td>
                                        <td style="width: 20px;" align="center">
                                           <input onchange=UpdateCategory('<%=item.ID %>',""+this.value+"",'SortId') type="text" name="SortId" style="text-align:center" value="<%=item.Priority %>" />
                                        </td>                                                                                                                                                          
                                        <td style="width: 120px;" align="center">
                                            <span style="display: none;">
                                                <a id="" href="#" onclick="" class="Action" title="Cập nhật sản phẩm này">Cập nhật</a> | </span>
                                                <a href="/ArticleCategory/Edit/<%=item.ID %>" class="Action" title="Chỉnh sửa danh mục này">Chỉnh sửa</a> | <a href="/ArticleCategory/Delete/<%=item.ID%>" class="Action" title="Xóa danh mục này">Xóa</a>
                                        </td>
                                    </tr>
                                    <% } %>
                                </tbody>
                            </table>
                        </div>
                    </div>

                    <link rel="Stylesheet" href="admin.aspx_files/pagenavigation.css" type="text/css">
                    <div class="PageNavigation" style="margin-bottom: 10px; margin-top: 10px;" align="center">                      
                    
                    </div>
                </div>

                <div class="ui-widget-content ui-corner-top ui-corner-bottom">
                    <div id="toolbox">
                        <div class="header" style="float:left;">
                            <img id="ctl00_cph_Main_ctl00_ctl00_toolbox2_imgHeader" src="/Content/Images/header/icon-48-generic.png" style="border-width: 0px;">
                            <span id="ctl00_cph_Main_ctl00_ctl00_toolbox2_lblTitle">Danh mục tin tức</span>
                        </div>
                        <div style="float:right;">
                            <table class="toolbar">
                                <tbody>
                                <tr>                                     
                                        <td align="center">
                                            <a id="A1" title="Thêm mới" class="toolbar" href="/AticleCategory/Create"><span id="Span1" title="Thêm mới" class="Icon-32-Add"></span>Thêm mới</a>
                                        </td>                                       
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    </form>
<script type="text/javascript">
    $j(function() {             
        $j(".changeStatus").live("click", function() {
            var pId = this.id;
            $j.ajax({
                url: "/ArticleCategory/ChangeStatus",
                type: "POST",
                data: { id: this.id },
                success: function(data) {
                    $j(".imgs_" + pId).html("");
                    $j(".imgs_" + pId).html(data);
                }
            });
        });
    });
    function UpdateCategory(id, pName,pType) {
        $j.ajax({
            url:"/ArticleCategory/UpdateAjax",
            type:"POST",
            data:{id:id,Value:pName,pType:pType},
            success: function() {
                
            }
        });
    }
</script>

</asp:Content>
